<template>
	<view>
		<view class="shopBox">
			<u-row>
				<u-col span="6" v-for="(item,index) in shoparr" :key='index'>
					<view class="shopval" @click="goxiangqing(item)">
						<u-image width="100%" height="344rpx" :src="item.image"></u-image>
						<view class="shop_name">
							{{item.store_name}}
						</view>
						<view class="shop_msg">
							<!-- {{item.msg}} -->
						</view>
						<view class="jiageBox">
							FCFA{{item.price}}
						</view>
					</view>
				</u-col>
			</u-row>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shoparr: [],
				info: null,
				page: 1
			};
		},
		onLoad() {
			uni.getStorage({
				key: 'userinfo',
				success: (res) => {
					this.info = res.data
				}
			})
			this.getlist()
		},
		onReachBottom() {
			this.page++
			this.pushlist()
		},
		methods: {
			getlist() {
				uni.request({
					url: this.$AJAX_URL + 'goods/product_spec_list',
					method: 'POST',
					data: {
						page: this.page
					},
					success: (res) => {
						console.log(res);
						this.shoparr = res.data.data
					}
				})
			},
			pushlist() {
				uni.request({
					url: this.$AJAX_URL + 'goods/product_spec_list',
					method: 'POST',
					data: {
						page: this.page
					},
					success: (res) => {
						console.log(res);
						for (var i = 0; i < res.data.data.length; i++) {
							this.shoparr.push(res.data.data[i])
						}
					}
				})
			},
			goxiangqing(item) {
				uni.navigateTo({
					url: '../msxiangqing/msxiangqing?id=' + item.id
				})
			}
		}
	}
</script>

<style lang="scss">
	.shopBox {
		margin-top: 40rpx;

		.shopval {
			margin-bottom: 20rpx;
			height: 530rpx;
			border-radius: 20rpx;
			background: #FFFFFF;
			overflow: hidden;

			.shop_name {
				margin-left: 15rpx;
				font-size: 32rpx;
				margin-top: 19rpx;
				margin-right: 20rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.shop_msg {
				margin-left: 10rpx;
				margin-right: 28rpx;
				font-size: 24rpx;
				color: #333333;
				margin-top: 10rpx;
			}

			.jiageBox {
				color: #FF392B;
				font-size: 30rpx;
				margin-left: 17rpx;
				margin-top: 10rpx;
			}
		}
	}
</style>
